﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RequestModel
{
	[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
	public sealed class FromRequestAttribute : Attribute
	{
		public string RequestKey { get; set; }
		public bool Required { get; set; }//mostly for strings, but can be used for nullables also that i dont want to be empty
		public bool ArrayElementRequired { get; set; }//in case of arrays, declares if items are required or can be null
		public string ArrayElementSeperator { get; set; }//in case of arrays, declares array seperator

		public FromRequestAttribute(string requestKey, bool required = false)
			: this()
		{
			RequestKey = requestKey;
			Required = required;
		}

		public FromRequestAttribute(bool required = false)
			: this()
		{
			Required = required;
		}

		public FromRequestAttribute()
		{
			ArrayElementSeperator = "-";
		}
	}
}
